home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / pine / pine3.07 / pico / pico.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-30  |  8.3 KB  |  298 lines

  1. /*
  2.  * Program:    pico.h - definitions for Pine's composer library
  3.  *
  4.  * Author:    Michael Seibel
  5.  *        Networks and Distributed Computing
  6.  *        Computing & Communications
  7.  *        University of Washington
  8.  *        Administration Building, AG-44
  9.  *        Seattle, WA  98195
  10.  *        Internet: mikes@cac.washington.edu
  11.  *
  12.  * Date:    14 Jan 90
  13.  * Last Edited:    9 Jan 1991
  14.  *
  15.  * Copyright 1991 by the University of Washington
  16.  *
  17.  *  Permission to use, copy, modify, and distribute this software and its
  18.  * documentation for any purpose and without fee is hereby granted, provided
  19.  * that the above copyright notice appears in all copies and that both the
  20.  * above copyright notice and this permission notice appear in supporting
  21.  * documentation, and that the name of the University of Washington not be
  22.  * used in advertising or publicity pertaining to distribution of the software
  23.  * without specific, written prior permission.  This software is made
  24.  * available "as is", and
  25.  * THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
  26.  * WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED
  27.  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN
  28.  * NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL,
  29.  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  30.  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT
  31.  * (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION
  32.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  33.  *
  34.  */
  35.  
  36.  
  37. #ifndef    PICO_H
  38. #define    PICO_H
  39. /*
  40.  * Defined for attachment support
  41.  */
  42. #define    ATTACHMENTS    1
  43.  
  44.  
  45. /*
  46.  * defs of return codes from pine mailer composer.
  47.  */
  48. #define    BUF_CHANGED    0x01
  49. #define    COMP_CANCEL    0x02
  50. #define    COMP_EXIT    0x04
  51. #define    COMP_FAILED    0x08
  52. #define    COMP_SUSPEND    0x10
  53. #define    COMP_GOTHUP    0x20
  54.  
  55.  
  56. /*
  57.  * top line from the top of the screen for the editor to do 
  58.  * its stuff
  59.  */
  60. #define    COMPOSER_TOP_LINE    2
  61. #define    COMPOSER_TITLE_LINE    0
  62.  
  63. /*
  64.  * definitions of Mail header array indexes
  65.  */
  66. #define    TOHDR        0
  67. #define    CCHDR        1
  68. #define    BCCHDR        2
  69. #define    FCCHDR        3
  70. #ifdef    ATTACHMENTS
  71. #define    ATTCHDR        4
  72. #define    SUBJHDR        5
  73. #define    LASTHDR        5
  74. #else
  75. #define    SUBJHDR        4
  76. #define    LASTHDR        4
  77. #endif
  78.  
  79.  
  80.  
  81. /*
  82.  * definitions of Mail header structures 
  83.  */
  84. struct hdr_line {
  85.         char text[256];
  86.         struct  hdr_line        *next;
  87.         struct  hdr_line        *prev;
  88. };
  89.  
  90. struct headerentry {
  91.         char    *prompt;
  92.     char    *name;
  93. #ifdef    DOS
  94.     short    help;
  95. #else
  96.     char    **help;
  97. #endif
  98.         int     prlen;
  99.         int     maxlen;
  100.         int     display_it;
  101.         char    **realaddr;
  102.         struct  hdr_line        *hd_text;
  103. };
  104.  
  105.  
  106. /*
  107.  * structure to keep track of header display
  108.  */
  109. struct on_display {
  110.     int             p_off;            /* offset into line */
  111.     int             p_len;            /* length of line   */
  112.     int             p_line;        /* physical line on screen */
  113.     int             top_e;            /* topline's header entry */
  114.     struct hdr_line    *top_l;            /* top line on display */
  115.     int             cur_e;            /* current header entry */
  116.     struct hdr_line    *cur_l;            /* current hd_line */
  117. };                        /* global on_display struct */
  118.  
  119.  
  120. /*
  121.  * Structure to handle attachments
  122.  */
  123. typedef struct pico_atmt {
  124.     char *description;
  125.     char *filename;
  126.     char *size;
  127.     char *id;
  128.     unsigned short flags;
  129.     struct pico_atmt *next;
  130. } PATMT;
  131.  
  132.  
  133. /*
  134.  * Flags for attachment handling
  135.  */
  136. #define    A_FLIT    0x0001            /* accept literal file and size  */
  137.  
  138.  
  139. /*
  140.  * Master pine composer structure.  Right now there's not much checking
  141.  * that any of these are pointing to something, so pine must have them pointing
  142.  * somewhere.
  143.  */
  144. typedef struct pico_struct {
  145.     char  *messagebuf;            /* ptrs to malloc'd arrays of char */
  146.     int    messbuflen;            /* lengths of the malloc'd space */
  147.     char  *tobuf;            /* it's that way so it can be */
  148.     int    tolen;            /* realloc'd or free'd as its size  */
  149.     char  *ccbuf;            /* changes. */
  150.     int    cclen;
  151.     char  *bccbuf;
  152.     int    bcclen;
  153.     char  *subbuf;
  154.     int    sublen;
  155.     char  *fccbuf;
  156.     int    fcclen;
  157.     char  *pine_anchor;            /* ptr to pine anchor line */
  158.     char  *pine_version;        /* string containing Pine's version */
  159.     char  *alt_ed;            /* name of alternate editor or NULL */
  160.     PATMT *attachments;            /* linked list of attachments */
  161.     unsigned pine_flags;        /* entry mode flags */
  162.     void  (*helper)();            /* Pine's help function  */
  163.     void  (*showmsg)();            /* Pine's display_message */
  164.     void  (*keybinit)();        /* Pine's keyboard initializer  */
  165.     int   (*raw_io)();            /* Pine's Raw() */
  166.     int   (*folders)();            /* Pine's folders_for_fcc */
  167.     int   (*buildaddr)();        /* Pine's build_address */
  168.     long  (*newmail)();            /* Pine's report_new_mail */
  169.     char  *(*addrbook)();        /* Pine's addr_book */
  170. #ifdef    DOS
  171.     short to_help;            /* various pine help text arrays */
  172.     short cc_help;
  173.     short bcc_help;
  174.     short fcc_help;
  175.     short subject_help;
  176.     short search_help;
  177.     short ins_help;
  178.     short composer_help;
  179.     short attachment_help;
  180.     short browse_help;
  181. #else
  182.     char  **to_help;            /* various pine help text arrays */
  183.     char  **cc_help;
  184.     char  **bcc_help;
  185.     char  **fcc_help;
  186.     char  **subject_help;
  187.     char  **search_help;
  188.     char  **ins_help;
  189.     char  **composer_help;
  190.     char  **attachment_help;
  191.     char  **browse_help;
  192. #endif
  193. } PICO;
  194.  
  195. /*
  196.  * various flags that they may passed to PICO
  197.  */
  198. #define    P_LOCALLF    0x8000        /* use local vs. NVT EOL     */
  199. #define    P_REPLY        0x4000        /* start composer in body     */
  200. #define    P_FKEYS        MDFKEY        /* run in function key mode      */
  201. #define    P_SECURE    MDSCUR        /* run in restricted (demo) mode */
  202. #define    P_SUSPEND    MDSSPD        /* allow ^Z suspension         */
  203. #define    P_ADVANCED    MDADVN        /* enable advanced features     */
  204.  
  205.  
  206. /*
  207.  * definitions for various PICO modes 
  208.  */
  209. #define    MDWRAP        0x0001        /* word wrap            */
  210. #define    MDCMOD        0x0002        /* C indentation and fence match*/
  211. #define    MDSPELL        0x0004        /* spell error parcing        */
  212. #define    MDEXACT        0x0008        /* Exact matching for searches    */
  213. #define    MDVIEW        0x0010        /* read-only buffer        */
  214. #define MDOVER        0x0020        /* overwrite mode        */
  215. #define MDFKEY        0x0040        /* function key  mode        */
  216. #define MDSCUR        0x0080        /* secure (for demo) mode    */
  217. #define MDSSPD        0x0100        /* suspendable mode        */
  218. #define MDADVN        0x0200        /* Pico's advanced mode        */
  219. #define MDTOOL        0x0400        /* "tool" mode (quick exit)    */
  220.  
  221.  
  222.  
  223.  
  224. /*
  225.  * function definitions...
  226.  */
  227. int pico();                /* main PINE composer routine */
  228. int wscrollw();                /* scrolling utility */
  229. int GetKey();                /* keyboard input function */
  230.  
  231.  
  232. /*
  233.  * Main defs 
  234.  */
  235. #ifdef    maindef
  236. PICO    *Pmaster = NULL;        /* composer specific stuff */
  237. char    *version = "1.8";        /* PICO version number */
  238. #else
  239. extern PICO *Pmaster;            /* composer specific stuff */
  240. extern char *version;            /* pico version! */
  241. #endif
  242.  
  243. /*
  244.  * defs for help line tags
  245.  */
  246. #ifdef    termdef
  247.  
  248.  
  249. char *funckeynames = "~F~1,~F~3,~F~5,~F~7,~ ~F~9,~F~1~1,~F~2,~F~4,~F~6,~F~8,~F~1~0,~F~1~2,     ";
  250. char *justnames  = "~^~G,~^~C,~^~R,~^~Y,~^~K,~^~O,~^~X,~^~T,~^~W,~^~V,~^~U,~^~D,     "; 
  251.  
  252. char *HelpKeyNames;
  253. #else
  254. extern char *funckeynames;
  255. extern char *justnames;
  256.  
  257. extern char *HelpKeyNames;
  258. #endif
  259.  
  260.  
  261. /*
  262.  * number of keystrokes to delay removing an error message
  263.  */
  264. #define    MESSDELAY    20
  265.  
  266.  
  267. /*
  268.  * defs for keypad and function keys...
  269.  */
  270. #define K_PAD_UP        0x0811
  271. #define K_PAD_DOWN      0x0812
  272. #define K_PAD_RIGHT     0x0813
  273. #define K_PAD_LEFT      0x0814
  274. #define K_PAD_PREVPAGE  0x0815
  275. #define K_PAD_NEXTPAGE    0x0816
  276. #define K_PAD_HOME    0x0817
  277. #define K_PAD_END    0x0818
  278. #define BADESC          0x0819
  279. #define NODATA          0x08FF
  280.  
  281. /*
  282.  * defines for function keys
  283.  */
  284. #define F1      0x1001                  /* Functin key one              */
  285. #define F2      0x1002                  /* Functin key two              */
  286. #define F3      0x1003                  /* Functin key three            */
  287. #define F4      0x1004                  /* Functin key four             */
  288. #define F5      0x1005                  /* Functin key five             */
  289. #define F6      0x1006                  /* Functin key six              */
  290. #define F7      0x1007                  /* Functin key seven            */
  291. #define F8      0x1008                  /* Functin key eight            */
  292. #define F9      0x1009                  /* Functin key nine             */
  293. #define F10     0x100A                  /* Functin key ten              */
  294. #define F11     0x100B                  /* Functin key eleven           */
  295. #define F12     0x100C                  /* Functin key twelve           */
  296.  
  297. #endif    /* PICO_H */
  298.